<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算个税</title>
		<script type="text/javascript">
			function cal() {
				var a = document.getElementById("salary").value;
				var tax = 0;
				if (a >= 20000) {
					tax = (a - 20000) * 0.1 + 690;
				} else if (a >= 8000) {
					tax = (a - 8000) * 0.05 + 90;
				} else if (a >= 3500) {
					tax = (a - 3500) * 0.02;
				} else {
					tax = 0;
				}
				document.getElementById("tax").value = tax;
			}
		</script>
	</head>
	<body>
		<input type="number" id ="salary" placeholder="请输入工资" />
		<input id="tax" type="number"/>
		<button onclick="cal()">应缴纳个税为</button>
	</body>
</html>
